package org.example.aienglishapp.mapper.progress;


import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.example.aienglishapp.entity.progress.Course;

import java.util.List;

@Mapper
public interface CourseMapper {
    // 获取所有可选课程（未被用户选修的课程）
    List<Course> getAvailableCourses(@Param("courseId") Long courseId);

    // 获取用户已选课程
    List<Course> getEnrolledCourses(@Param("userId") Long userId);
    // 插入选课记录
    void insertEnrollment(@Param("userId") Long userId, @Param("courseId") Long courseId);

    // 检查选课记录是否存在
    boolean existsByUserIdAndCourseId(@Param("userId") Long userId, @Param("courseId") Long courseId);

    void deleteEnrollment(@Param("userId") Long userId, @Param("courseId") Long courseId);
}